package com.xsmart.oa.services.wx;

import com.xsmart.common.constant.ResultConstant;
import com.xsmart.common.entity.RequestBean;
import com.xsmart.common.entity.ResponseBean;
import com.xsmart.oa.dao.wx.UserInfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class UserInfoService {
    @Autowired
    UserInfoDao userInfoDao;

    /**
     * 查询会员信息
     * @param requestBean
     * @return
     */
    public ResponseBean queryUserInfo(RequestBean requestBean) {
        Integer userId = requestBean.getRequestParamInteger("userId");
        Map<String,Object> userInfo = userInfoDao.queryUserInfo(userId);
        ResponseBean responseBean = requestBean.getResponseBean();
        responseBean.addResultItem("userInfo",userInfo);
        responseBean.setResult(ResultConstant.SUCCESS);
        return responseBean;
    }

    /**
     * 查询分销商申请状态
     * @param requestBean
     * @return
     */
    public ResponseBean queryApplyStatus(RequestBean requestBean){
        Integer userId = requestBean.getRequestParamInteger("userId");
        Map<String, Object> map = userInfoDao.queryApplyStatus(userId);
        ResponseBean responseBean = requestBean.getResponseBean();
        responseBean.addResultItem("userApplyInfo", map);
        responseBean.setResult(ResultConstant.SUCCESS);
        return responseBean;
    }
}
